package cn.yuanqiao.web.controller.cqbc;

import cn.yuanqiao.common.utils.poi.ExcelUtil;
import cn.yuanqiao.common.core.controller.BaseController;
import cn.yuanqiao.common.core.domain.AjaxResult;
import cn.yuanqiao.common.core.page.TableDataInfo;
import cn.yuanqiao.common.annotation.Log;
import cn.yuanqiao.common.enums.BusinessType;
import cn.yuanqiao.cqbc.yqCarrierManage.domain.YqCarriermanageDetail;
import cn.yuanqiao.cqbc.yqCarrierManage.service.YqCarriermanageDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 载体检测详情表控制器
 *
 * @author lyk
 * @Date 2022-11-21 18:06:31
 */
@RestController
@RequestMapping("/cqbc/yqCarriermanageDetail")
public class YqCarriermanageDetailController extends BaseController {

    @Autowired
    private YqCarriermanageDetailService yqCarriermanageDetailService;
    /**
     * 新增接口
     *
     * @author lyk
     * @Date 2022-11-21
     */
    /*@RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(YqCarriermanageDetailParam yqCarriermanageDetailParam) {
        this.yqCarriermanageDetailService.add(yqCarriermanageDetailParam);
        return ResponseData.success();
    }

    *//**
     * 编辑接口
     *
     * @author lyk
     * @Date 2022-11-21
     *//*
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(YqCarriermanageDetailParam yqCarriermanageDetailParam) {
        this.yqCarriermanageDetailService.update(yqCarriermanageDetailParam);
        return ResponseData.success();
    }

    *//**
     * 删除接口
     *
     * @author lyk
     * @Date 2022-11-21
     *//*
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(YqCarriermanageDetailParam yqCarriermanageDetailParam) {
        this.yqCarriermanageDetailService.delete(yqCarriermanageDetailParam);
        return ResponseData.success();
    }

    *//**
     * 查看详情接口
     *
     * @author lyk
     * @Date 2022-11-21
     *//*
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(YqCarriermanageDetailParam yqCarriermanageDetailParam) {
        YqCarriermanageDetail detail = this.yqCarriermanageDetailService.getById(yqCarriermanageDetailParam.getId());
        return ResponseData.success(detail);
    }*/

    /**
     * 查询列表
     *
     * @author lyk
     * @Date 2022-11-21
     */
    @Log(title = "载体检测详情列表查询", businessType = BusinessType.SELECT)
    @GetMapping("/list")
    public TableDataInfo list(YqCarriermanageDetail yqCarriermanageDetailParam) {
        startPage();
        List<YqCarriermanageDetail> list = yqCarriermanageDetailService.findPageBySpec(yqCarriermanageDetailParam);
        return getDataTable(list);
    }


    @Log(title = "载体检测详情列表详情", businessType = BusinessType.SELECT)
    @GetMapping("/listByBatchId")
    public TableDataInfo listByBatchId(@RequestBody YqCarriermanageDetail yqCarriermanageDetailParam) {
        startPage();
        List<YqCarriermanageDetail> list = yqCarriermanageDetailService.findPageByBatchId(yqCarriermanageDetailParam);
        return getDataTable(list);
    }

    /**
     * 删除接口
     *
     * @author lyk
     * @Date 2022-11-21
     */
    @DeleteMapping("/deleteByBatchId")
    @Log(title = "载体检测详情删除", businessType = BusinessType.DELETE)
    public AjaxResult deleteByBatchId(@RequestBody YqCarriermanageDetail yqCarriermanageDetailParam) {
        return toAjax(yqCarriermanageDetailService.deleteByBatchId(yqCarriermanageDetailParam));
    }


    @Log(title = "载体检测详情列表导出", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, YqCarriermanageDetail yqCarriermanageDetailParam)
    {
        List<YqCarriermanageDetail> list = yqCarriermanageDetailService.findPageBySpec(yqCarriermanageDetailParam);
        ExcelUtil<YqCarriermanageDetail> util = new ExcelUtil<YqCarriermanageDetail>(YqCarriermanageDetail.class);
        util.exportExcel(response, list, "载体检测详情数据");
    }

}


